<div class="input send_weibo repeat" model-node="comment_textarea" id="reply_box">
	<div class="action clearfix mb10">
		<div class="num right" model-node="numsLeft">{:L('PUBLIC_INPUT_CHARACTER_LIMIT',array('num'=>'<span>'.$initNums.'</span>'))}</div>
	</div>
	<div model-node="reply_model">
		<div class="input_before mb10" model-node="mini_editor">
		<textarea class="input_tips" event-node="mini_editor_textarea" id="mini_editor_textarea" hidefocus="true" style="height: 60px;width:97.5%" model-args='t=comment'></textarea>
		</div>
		<div class="action clearfix">
			<div><a href="javascript:replycomment();" id="replycomment" class="btn-green-small right">{:L('PUBLIC_STREAM_REPLY')}</a></div>
			<div class="acts"><a class="face-block" href="javascript:;" event-node="comment_insert_face"><i class="face"></i>表情</a></div>
		    <div class="clear"></div>
		    <div model-node="faceDiv"></div>
		    <eq name='canrepost' value="1">    
		        <p><label><input type="checkbox" class="checkbox" name="shareFeed" value="1">{:L('PUBLIC_SHARETO_STREAM')}</label><p>     
		    </eq>
		    <php>if($feedtype == 'repost' && $cancomment == 1):</php> 
		    <p><label><input type="checkbox" class="checkbox" name="comment" value="1">同时评论给原文作者&nbsp;{$user_info.space_link_no}</label></p>
		    <php>endif;</php>    
		</div>
	</div>
</div>
<script>

var initNums = '{$initNums}';
var replylock = 0;
//回复评论
function replycomment(){
	if ( replylock == 1 ){
		return;
	}
	var appname = '{$commentInfo.app}';
	var table = '{$commentInfo.table}';
	var appuid= {$commentInfo.app_uid};
	var rowid = {$commentInfo.row_id};
	var tocommentid = {$commentInfo.comment_id};
	var touid = {$commentInfo.uid};
	var approwid = 0;
	var content = document.getElementById('mini_editor_textarea').value;
	var ifsharefeed = document.getElementsByName('shareFeed')[0] == undefined ? 0 : Number(document.getElementsByName('shareFeed')[0].checked);
	var commentold = document.getElementsByName('comment')[0] == undefined ? 0 : Number(document.getElementsByName('comment')[0].checked);
	content = content.replace('<br>','');
	var strlen = core.getLength(content);
	var leftnums = initNums - strlen;
	if(leftnums < 0 || leftnums == initNums) {
		//ui.error(L('PUBLIC_CONCENT_TIPES'));
		flashTextarea(document.getElementById('mini_editor_textarea'));
		return;
	}
	$('#replycomment').html('回复中..');
	$.post(U('widget/Comment/addcomment'),{
		app_name:appname,
		table_name:table,
		app_uid:appuid,
		row_id:rowid,
		to_comment_id:tocommentid,
		to_uid:touid,
		app_row_id:approwid,
		content:content,
		ifShareFeed:ifsharefeed,
		comment_old:commentold
		},function(msg){
			if(msg.status == "0"){
				ui.error(msg.data);
			}else{
				ui.box.close();
				ui.success( L('PUBLIC_CENTSUCCESS') );
			}
			$('#replycomment').html('<span>回复</span>');
		});
	replylock = 1;
}
$(function (){
	//M(document.getElementById('tsbox'));
	shortcut('ctrl+return', replycomment , {target:'mini_editor_textarea'});
	atWho($('#mini_editor_textarea'));
	setTimeout(function (){
		$('#mini_editor_textarea').inputToEnd('{$initHtml}');
	},300);
});
M(document.getElementById('tsbox'));
</script>